package com.herenit.beijing.dh2011.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.*;

@Entity
@Table(name = "ET_CODING_SCHEMES")
public class EtCodingSchemes implements Serializable {

	private static final long serialVersionUID = 1L;
	@TableGenerator(
			name = "idGenerator", 
			table = "ET_Id_Generator", 
			pkColumnName = "pkColumn",
			valueColumnName = "valueColumn",
			pkColumnValue = "CodingScheme_Id",
			allocationSize = 100,
			initialValue = 4300
			)
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "idGenerator")
	private long id;

	@Column(name = "CODINGSCHEME_OID")
	private String oid;

	@Column(name = "CODINGSCHEME_CH_NAME", nullable = false)
	private String cnName;

	@Column(name = "CODINGSCHEME_EN_NAME", nullable = false)
	private String enName;

	@Column(name = "CODINGSCHEME_DESC")
	private String desc;

	@Column(name = "EDITABLE", nullable = false)
	private boolean editable;

	@Column(name = "CREATED_BY", nullable = false)
	private long createdBy;

	@Column(name = "CREATED_BY_NAME", nullable = false)
	private String createdByName;

	@Column(name = "CREATION_DATE", nullable = false)
	private Timestamp creationDate;

	@Column(name = "LAST_UPDATED_BY", nullable = false)
	private long lastUpdatedBy;

	@Column(name = "LAST_UPDATED_BY_NAME", nullable = false)
	private String lastUpdatedByName;

	@Column(name = "LAST_UPDATE_DATE", nullable = false)
	private Timestamp lastUpdateDate;

	@Column(name = "INPUT_PY")
	private String pinyinCode;

	@Column(name = "INPUT_WB")
	private String wubiCode;

	@Column(name = "COMPLEXABLE")
	private boolean complexable;

	@OneToMany(mappedBy = "etCodingSchemes",fetch=FetchType.LAZY)   
	private List<EtVersions> etVersionsList ;

	@ManyToOne
	@JoinColumn(name = "model_id")
	private EtModels etModels;

	public EtCodingSchemes() {
		Long i = new Long(1);
		Timestamp nowTime = new Timestamp(new Date().getTime());
		createdBy = i;
		creationDate = nowTime;
		lastUpdatedBy = i;
		lastUpdateDate = nowTime;

	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getOid() {
		return oid;
	}

	public void setOid(String oid) {
		this.oid = oid;
	}

	public String getCnName() {
		return cnName;
	}

	public void setCnName(String cnName) {
		this.cnName = cnName;
	}

	public String getEnName() {
		return enName;
	}

	public void setEnName(String enName) {
		this.enName = enName;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public boolean isEditable() {
		return editable;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	public long getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(long createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedByName() {
		return createdByName;
	}

	public void setCreatedByName(String createdByName) {
		this.createdByName = createdByName;
	}

	public Timestamp getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Timestamp creationDate) {
		this.creationDate = creationDate;
	}

	public long getLastUpdatedBy() {
		return lastUpdatedBy;
	}

	public void setLastUpdatedBy(long lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}

	public String getLastUpdatedByName() {
		return lastUpdatedByName;
	}

	public void setLastUpdatedByName(String lastUpdatedByName) {
		this.lastUpdatedByName = lastUpdatedByName;
	}

	public Timestamp getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Timestamp lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public String getPinyinCode() {
		return pinyinCode;
	}

	public void setPinyinCode(String pinyinCode) {
		this.pinyinCode = pinyinCode;
	}

	public String getWubiCode() {
		return wubiCode;
	}

	public void setWubiCode(String wubiCode) {
		this.wubiCode = wubiCode;
	}

	public boolean isComplexable() {
		return complexable;
	}

	public void setComplexable(boolean complexable) {
		this.complexable = complexable;
	}

	public List<EtVersions> getEtVersionsList() {
		return etVersionsList;
	}

	public void setEtVersionsList(List<EtVersions> etVersionsList) {
		this.etVersionsList = etVersionsList;
	}

	public EtModels getEtModels() {
		return etModels;
	}

	public void setEtModels(EtModels etModels) {
		this.etModels = etModels;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
